Skip to content

Compare the controls of the macOS look with AppKit in CI - #1111

Closed
beetlebugorg wants to merge 0 commit into
mainfrom
pixel-harness
Closed

beetlebugorg wants to merge 0 commit into
mainfrom
pixel-harness

Conversation

@beetlebugorg

@beetlebugorg beetlebugorg commented Dec 4, 2026 •

Copy link
Copy Markdown
Owner

Closes #1072. Part of #154. Stacked on #1110 (#1071 part 2).

Step 5 of the macOS part of docs/dev/native-look.md: the pixel harness.

  • src/tests/aqua_pixels.zig reads the output folder of zig build native-ref from ZTK_NATIVE_REF. For each control and state in the regular size, light and dark, it reads the frame from measures.json and the scale from pixels_wide, makes the same ttk widget on the headless backend with Core Text, and compares the pixels with the AppKit render placed over the window color of ztk. The score of a case is the fraction of pixels with a channel more than 40 apart, at the best shift of up to 4 pixels. A case fails above its limit.
  • It writes report.md (one row for each case) and compare/NAME.png (AppKit at the left, ztk at the right). Without ZTK_NATIVE_REF the test is skipped, so zig build test does not change.
  • The job pixel-macos of CI (macOS runner, on a change of code) runs native-ref and the test, puts the report in the summary of the job with the version of macOS, and keeps the pictures as the artifact pixel-macos.
  • The limits are the scores on macOS 27.0 plus 0.05. A change that brings a control closer lowers its limit in the same PR.

The cases: the push button (rest, disabled, default), the check box, the radio button, and the switch (rest, on, disabled), the slider (rest, on, disabled), the pop-up and the pull-down button, the text field, and the combo box (rest, disabled), the segmented control (rest, on, disabled), the progress bar, the tab view (rest, disabled), and the box. Not in it, with the reason:

  • the stepper and the spinner: no ttk widget of their own;
  • the scroller: AppKit draws a legacy scroller empty with no window on the screen (the scrollers are macOS look: scrolling with momentum, overlay scrollers, and the motion of AppKit (step 7) #1074);
  • the inactive window, the pressed state, and the focus: native-ref renders the inactive window, and ztk has no state of an inactive window on the headless backend yet; native-ref has no pressed or focused state. These are a follow-up.

The color space: cacheDisplayInRect renders in the color space of the screen, and screencapture too. On a display with a wide gamut, the accent of AppKit, controlAccentColor = #007aff in sRGB (light and dark, from AppKit), comes out as #2f77f6 to #3478f6. ztk draws in sRGB, so native-ref now converts each render to sRGB (second commit), where the AppKit render of the default button is exactly #007aff. The fallback accent of the sheet (#007aff) is right, and a real window uses controlAccentColor from the backend (appkit.zig accentColor, --system-accent), so the choice of the user wins. The grays of the captures do not change in sRGB.

What the scores show on macOS 27, for the next steps:

  • The switch: the switch of ztk is smaller than NSSwitch (0.49 on, 0.71 on in dark).
  • The default button: 0.33, from its size and its text, with the color equal.
  • The other controls are at 0.00 to 0.16; the selected segment is at 0.03.

The report on macOS 27.0 (26A428):

Control State Appearance Score Limit Shift
push rest light 0.024 0.080 0,0
push disabled light 0.000 0.050 0,0
push default light 0.331 0.390 0,0
check rest light 0.047 0.100 2,0
check on light 0.086 0.140 2,0
check disabled light 0.000 0.050 2,0
radio rest light 0.039 0.090 2,0
radio on light 0.107 0.160 2,0
radio disabled light 0.000 0.050 2,0
toggle rest light 0.017 0.070 -4,-4
toggle on light 0.491 0.550 4,-4
toggle disabled light 0.016 0.070 -4,-4
slider rest light 0.051 0.110 2,-2
slider on light 0.068 0.120 2,-2
slider disabled light 0.058 0.110 2,-1
popup rest light 0.112 0.170 -1,1
popup disabled light 0.075 0.130 -1,0
pulldown rest light 0.110 0.160 2,0
pulldown disabled light 0.072 0.130 1,0
field rest light 0.013 0.070 2,0
field disabled light 0.001 0.060 2,0
combo rest light 0.031 0.090 2,0
combo disabled light 0.009 0.060 2,0
segmented rest light 0.033 0.090 0,0
segmented on light 0.032 0.090 0,0
segmented disabled light 0.347 0.400 0,0
progress rest light 0.032 0.090 1,0
tabview rest light 0.016 0.070 -4,-4
tabview disabled light 0.016 0.070 -4,-4
box rest light 0.007 0.060 -1,0
push rest dark 0.047 0.100 0,0
push disabled dark 0.000 0.050 0,0
push default dark 0.331 0.390 0,0
check rest dark 0.077 0.130 2,0
check on dark 0.116 0.170 2,0
check disabled dark 0.002 0.060 2,0
radio rest dark 0.073 0.130 2,0
radio on dark 0.137 0.190 2,0
radio disabled dark 0.001 0.060 2,0
toggle rest dark 0.351 0.410 -4,-4
toggle on dark 0.714 0.770 4,-4
toggle disabled dark 0.432 0.490 -4,-4
slider rest dark 0.067 0.120 1,-2
slider on dark 0.084 0.140 1,-2
slider disabled dark 0.070 0.130 -1,-2
popup rest dark 0.117 0.170 0,1
popup disabled dark 0.067 0.120 0,1
pulldown rest dark 0.112 0.170 2,0
pulldown disabled dark 0.064 0.120 1,0
field rest dark 0.017 0.070 2,0
field disabled dark 0.003 0.060 2,0
combo rest dark 0.042 0.100 2,0
combo disabled dark 0.012 0.070 2,0
segmented rest dark 0.045 0.100 0,0
segmented on dark 0.042 0.100 0,0
segmented disabled dark 0.344 0.400 0,0
progress rest dark 0.032 0.090 1,0
tabview rest dark 0.048 0.100 -4,-4
tabview disabled dark 0.048 0.100 -4,-4
box rest dark 0.007 0.060 -1,1

CI runs the job on main and on the schedule (a pull request runs only the quick jobs); this report is from a run on the Mac.

Lines: estimate 250, actual +300 −3.

@beetlebugorg beetlebugorg added the opus-5.5 The agent that wrote this ran the model Opus 5.5 label Dec 4, 2026
@beetlebugorg
beetlebugorg changed the base branch from aqua-controls-2 to main December 4, 2026 20:30
@beetlebugorg beetlebugorg mentioned this pull request Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

opus-5.5 The agent that wrote this ran the model Opus 5.5

Projects

None yet

Development

Successfully merging this pull request may close these issues.

macOS look: the pixel harness in CI against the renders of AppKit (step 5)

1 participant